﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace CoreApp.DBAccess
{
    /// <summary>
    /// 基础仓库接口
    /// </summary>
    /// <typeparam name="T">类型</typeparam>
    public interface IRepositoryBase<T>
    {
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="sql">插入sql语句</param>
        /// <returns></returns>
        Task<int> Insert(T entity, string sql);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Id">id</param>
        /// <param name="sql">删除sql</param>
        /// <returns></returns>
        Task<int> Delete(int Id, string sql);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity">实体</param>
        /// <param name="sql">更新sql</param>
        /// <returns></returns>
        Task<int> Update(T entity, string sql);

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="Id">id</param>
        /// <param name="sql">查询sql</param>
        /// <returns></returns>
        Task<T> Query(int Id, string sql);
    }
}
